/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.lucava.boatskeeper.server.handler.user;

import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;
import org.lucava.boatskeeper.server.MockUserDao;
import org.lucava.boatskeeper.shared.rpc.user.AddUser;
import org.lucava.boatskeeper.shared.rpc.user.AddUserResult;

/**
 *
 * @author glenn
 */
public class AddUserHandler implements ActionHandler<AddUser, AddUserResult> {

    @Override
    public Class<AddUser> getActionType() {
        return AddUser.class;
    }

    @Override
    public AddUserResult execute(AddUser a, ExecutionContext ec) throws ActionException {

        MockUserDao.add(a.getData());

        AddUserResult addUserResult = new AddUserResult(a.getData());
        return addUserResult;
    }

    @Override
    public void rollback(AddUser a, AddUserResult r, ExecutionContext ec) throws ActionException {
    }
}
